<template>
	<view class="proitem" style="margin-bottom: 20rpx;" @click="todetail(pro)">
		<view class="timebox" v-if="pro.time>0">
			预告：{{$u.timeFormat(pro.auction_start_time, 'mm-dd hh:MM:ss')}}
			<!-- {{pro.auction_start_time}}~{{pro.auction_end_time}} -->
		</view>
		<view class="timebox" v-if="pro.time1<0">
			已结束
			<!-- {{pro.auction_start_time}}~{{pro.auction_end_time}} -->
		</view>

		<image class="pic" :src="pro.img" mode="aspectFill"></image>
		<view class="info">
			<view class="proname">
				{{pro.name}}
			</view>
			<view class="price">
				竞拍价格
			</view>
			<view class="pricebox">
				<image style="width: 15rpx;height: 18rpx;" src="./static/qian.png" mode=""></image>
				{{pro.price}}
			</view>
			<view class="dhbtn">
				去竞拍
			</view>
			<!-- <view class="dhbtn1" v-else>
				<u-count-down :time="pro.time" format="HH:mm:ss" @finish='finish'></u-count-down>
			</view> -->

		</view>
	</view>
</template>

<script>
	export default {
		name: "jfproitem",
		props: {
			pro: {
				type: Object,
				default () {
					return {

					};
				}
			}
		},
		data() {
			return {
				isfinish: false
			};
		},
		methods: {
			todetail(pro){
				let nowTime=new Date()
				let time= (new Date(pro.auction_start_time)).getTime() - nowTime.getTime()
				// console.log(time>0)
				if(time>0){
					console.log(12313)
					this.$u.toast('竞拍还未开始')
					return
				}
				this.go('/pages/jp/detail?id='+pro.id)
			},
			go(url) {
				uni.navigateTo({
					url
				})
			},
			// finish() {
			// 	// console.log('结束')
			// 	this.isfinish = true
			// }
		}
	}
</script>

<style lang="less">
	.proitem {
		width: 336rpx;
		position: relative;
	}

	.pic {
		width: 336rpx;
		height: 344rpx;
		border-radius: 15rpx 15rpx 0px 0px;
	}

	.info {
		width: 305rpx;
		padding: 20rpx 12rpx 20rpx 20rpx;
		// height: 129rpx;
		background: #FFFFFF;
		border-radius: 0px 0px 15rpx 15rpx;
		margin-top: -3px;
		position: relative;

		.proname {
			color: #181818;
			font-size: 28rpx;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
			line-height: 30rpx;
			font-weight: bold;
		}

		.price {
			width: fit-content;
			line-height: 37rpx;
			padding: 0 16rpx;
			background: linear-gradient(142deg, rgba(255, 160, 8, .2), rgba(255, 131, 5, .2));
			border-radius: 17rpx;
			margin: 16rpx 0 24rpx;
			font-size: 24rpx;
			color: #FF5F00;
			font-style: italic;
		}

		.pricebox {
			display: flex;
			align-items: center;
			font-size: 36rpx;
			font-weight: bold;
			color: #FD2A00;
			line-height: 28rpx;
		}

		.dhbtn {
			padding: 0 28rpx;
			line-height: 50rpx;
			border: 1rpx solid;
			background: linear-gradient(108deg, #F13038 0%, #E3331D 100%);
			border-image: linear-gradient(0deg, #FDF7A5, #FFFFFF) 10 10;
			background: #FF5F00;
			border-radius: 20rpx;
			color: #FFFFFF;
			font-size: 24rpx;
			font-weight: bold;
			width: fit-content;
			position: absolute;
			right: 17rpx;
			bottom: 17rpx;
		}

		.dhbtn1 {
			position: absolute;
			right: 17rpx;
			bottom: 17rpx;
		}
	}

	.flex {
		display: flex;
		align-items: center;
	}

	.jsb {
		justify-content: space-between;
	}

	.fs24 {
		font-size: 24rpx;
	}

	.fs30 {
		font-size: 30rpx;
	}

	.cfd2 {
		color: #FD2A00;
	}

	.fwb {
		font-weight: bold;
	}

	.fs22 {
		font-size: 22rpx;
	}

	.c919 {
		color: #919191;
	}

	.timebox {
		padding: 0 12rpx;
		font-size: 21rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #4CD3C7;
		line-height: 42rpx;
		background: #CEFEFC;
		border-radius: 15rpx 0 15rpx 0;
		position: absolute;
		z-index: 2;
	}
</style>